package com.lilike.music.common;

/**
 * 信息封装类
 *
 * @author weijun
 */
public class MessageBean {

    private MessageBean(){}

    private MessageBean(Type type, String content, Object... args){
        this.type = type;
        this.content =content;
        this.objs = args;
    }
    public static enum Type{
        SUCCESS,
        WARING,
        ERROR,
        INFO;
    }

    private Type type;
    private String content;
    private Object[] objs;

    /**
     * 返回成功信息
     *
     * @param content
     * @return
     */
    public static MessageBean success(String content){
        return info(Type.SUCCESS, content);
    }

    public static MessageBean success(String content, Object... args){
        return info(Type.SUCCESS, content, args);
    }

    /**
     * 返回警告信息
     *
     * @param content
     * @return
     */
    public static MessageBean waring(String content){
        return info(Type.WARING, content);
    }

    public static MessageBean waring(String content, Object args){
        return new MessageBean(Type.WARING, content, args);
    }
    /**
     * 返回错误信息
     *
     * @param content
     * @return
     */
    public static MessageBean error(String content){
        return info(Type.ERROR, content);
    }

    public static MessageBean error(String content, Object... args){
        return new MessageBean(Type.ERROR, content, args);
    }

    /**
     * 返回自己定义信息
     *
     * @param type
     * @param content
     * @return
     */
    public static MessageBean info(Type type, String content){
        return new MessageBean(type, content);
    }

    public static MessageBean info(Type type, String content, Object... args){
        return new MessageBean(type, content, args);
    }

    public Type getType() {
        return type;
    }

    public String getContent() {
        return content;
    }

    public Object[] getObjs() {
        return objs;
    }
}
